// **********************************************************************
//
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

// Ice version 3.2.1

package ru.fizteh.fivt.JobProcessor;

public final class ProcessorPrxHelper extends Ice.ObjectPrxHelperBase implements ProcessorPrx
{
    public void
    cancelJob(String id)
        throws UnknownJobIdException
    {
        cancelJob(id, null, false);
    }

    public void
    cancelJob(String id, java.util.Map<String, String> __ctx)
        throws UnknownJobIdException
    {
        cancelJob(id, __ctx, true);
    }

    @SuppressWarnings("unchecked")
    private void
    cancelJob(String id, java.util.Map<String, String> __ctx, boolean __explicitCtx)
        throws UnknownJobIdException
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __checkTwowayOnly("cancelJob");
                __delBase = __getDelegate();
                _ProcessorDel __del = (_ProcessorDel)__delBase;
                __del.cancelJob(id, __ctx);
                return;
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __handleExceptionWrapper(__delBase, __ex);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, __cnt);
            }
        }
    }

    public JobPrx
    getJob(Problem theProblem)
        throws TooManyJobsException
    {
        return getJob(theProblem, null, false);
    }

    public JobPrx
    getJob(Problem theProblem, java.util.Map<String, String> __ctx)
        throws TooManyJobsException
    {
        return getJob(theProblem, __ctx, true);
    }

    @SuppressWarnings("unchecked")
    private JobPrx
    getJob(Problem theProblem, java.util.Map<String, String> __ctx, boolean __explicitCtx)
        throws TooManyJobsException
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __checkTwowayOnly("getJob");
                __delBase = __getDelegate();
                _ProcessorDel __del = (_ProcessorDel)__delBase;
                return __del.getJob(theProblem, __ctx);
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __handleExceptionWrapper(__delBase, __ex);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, __cnt);
            }
        }
    }

    public JobInfo
    getJobInfo(String id)
        throws UnknownJobIdException
    {
        return getJobInfo(id, null, false);
    }

    public JobInfo
    getJobInfo(String id, java.util.Map<String, String> __ctx)
        throws UnknownJobIdException
    {
        return getJobInfo(id, __ctx, true);
    }

    @SuppressWarnings("unchecked")
    private JobInfo
    getJobInfo(String id, java.util.Map<String, String> __ctx, boolean __explicitCtx)
        throws UnknownJobIdException
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __checkTwowayOnly("getJobInfo");
                __delBase = __getDelegate();
                _ProcessorDel __del = (_ProcessorDel)__delBase;
                return __del.getJobInfo(id, __ctx);
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __cnt = __handleExceptionWrapperRelaxed(__delBase, __ex, __cnt);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, __cnt);
            }
        }
    }

    public Parameter[]
    getJobResult(String id)
        throws JobException,
               NotReadyException,
               UnknownJobIdException
    {
        return getJobResult(id, null, false);
    }

    public Parameter[]
    getJobResult(String id, java.util.Map<String, String> __ctx)
        throws JobException,
               NotReadyException,
               UnknownJobIdException
    {
        return getJobResult(id, __ctx, true);
    }

    @SuppressWarnings("unchecked")
    private Parameter[]
    getJobResult(String id, java.util.Map<String, String> __ctx, boolean __explicitCtx)
        throws JobException,
               NotReadyException,
               UnknownJobIdException
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __checkTwowayOnly("getJobResult");
                __delBase = __getDelegate();
                _ProcessorDel __del = (_ProcessorDel)__delBase;
                return __del.getJobResult(id, __ctx);
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __handleExceptionWrapper(__delBase, __ex);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, __cnt);
            }
        }
    }

    public String
    getJobStatus(String id)
        throws UnknownJobIdException
    {
        return getJobStatus(id, null, false);
    }

    public String
    getJobStatus(String id, java.util.Map<String, String> __ctx)
        throws UnknownJobIdException
    {
        return getJobStatus(id, __ctx, true);
    }

    @SuppressWarnings("unchecked")
    private String
    getJobStatus(String id, java.util.Map<String, String> __ctx, boolean __explicitCtx)
        throws UnknownJobIdException
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __checkTwowayOnly("getJobStatus");
                __delBase = __getDelegate();
                _ProcessorDel __del = (_ProcessorDel)__delBase;
                return __del.getJobStatus(id, __ctx);
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __cnt = __handleExceptionWrapperRelaxed(__delBase, __ex, __cnt);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, __cnt);
            }
        }
    }

    public java.util.Map<java.lang.String, JobInfo>
    getListOfJobs()
    {
        return getListOfJobs(null, false);
    }

    public java.util.Map<java.lang.String, JobInfo>
    getListOfJobs(java.util.Map<String, String> __ctx)
    {
        return getListOfJobs(__ctx, true);
    }

    @SuppressWarnings("unchecked")
    private java.util.Map<java.lang.String, JobInfo>
    getListOfJobs(java.util.Map<String, String> __ctx, boolean __explicitCtx)
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __checkTwowayOnly("getListOfJobs");
                __delBase = __getDelegate();
                _ProcessorDel __del = (_ProcessorDel)__delBase;
                return __del.getListOfJobs(__ctx);
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __cnt = __handleExceptionWrapperRelaxed(__delBase, __ex, __cnt);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, __cnt);
            }
        }
    }

    public java.util.Map<java.lang.String, java.lang.String>
    getProperties()
    {
        return getProperties(null, false);
    }

    public java.util.Map<java.lang.String, java.lang.String>
    getProperties(java.util.Map<String, String> __ctx)
    {
        return getProperties(__ctx, true);
    }

    @SuppressWarnings("unchecked")
    private java.util.Map<java.lang.String, java.lang.String>
    getProperties(java.util.Map<String, String> __ctx, boolean __explicitCtx)
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __checkTwowayOnly("getProperties");
                __delBase = __getDelegate();
                _ProcessorDel __del = (_ProcessorDel)__delBase;
                return __del.getProperties(__ctx);
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __cnt = __handleExceptionWrapperRelaxed(__delBase, __ex, __cnt);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, __cnt);
            }
        }
    }

    public java.util.Map<java.lang.String, java.lang.String>
    getSliceChecksums()
    {
        return getSliceChecksums(null, false);
    }

    public java.util.Map<java.lang.String, java.lang.String>
    getSliceChecksums(java.util.Map<String, String> __ctx)
    {
        return getSliceChecksums(__ctx, true);
    }

    @SuppressWarnings("unchecked")
    private java.util.Map<java.lang.String, java.lang.String>
    getSliceChecksums(java.util.Map<String, String> __ctx, boolean __explicitCtx)
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __checkTwowayOnly("getSliceChecksums");
                __delBase = __getDelegate();
                _ProcessorDel __del = (_ProcessorDel)__delBase;
                return __del.getSliceChecksums(__ctx);
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __cnt = __handleExceptionWrapperRelaxed(__delBase, __ex, __cnt);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, __cnt);
            }
        }
    }

    public Parameter[]
    solve(Problem theProblem)
        throws JobException,
               TooManyJobsException
    {
        return solve(theProblem, null, false);
    }

    public Parameter[]
    solve(Problem theProblem, java.util.Map<String, String> __ctx)
        throws JobException,
               TooManyJobsException
    {
        return solve(theProblem, __ctx, true);
    }

    @SuppressWarnings("unchecked")
    private Parameter[]
    solve(Problem theProblem, java.util.Map<String, String> __ctx, boolean __explicitCtx)
        throws JobException,
               TooManyJobsException
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __checkTwowayOnly("solve");
                __delBase = __getDelegate();
                _ProcessorDel __del = (_ProcessorDel)__delBase;
                return __del.solve(theProblem, __ctx);
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __handleExceptionWrapper(__delBase, __ex);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, __cnt);
            }
        }
    }

    public void
    solve_async(AMI_Processor_solve __cb, Problem theProblem)
    {
        solve_async(__cb, theProblem, null, false);
    }

    public void
    solve_async(AMI_Processor_solve __cb, Problem theProblem, java.util.Map<String, String> __ctx)
    {
        solve_async(__cb, theProblem, __ctx, true);
    }

    @SuppressWarnings("unchecked")
    private void
    solve_async(AMI_Processor_solve __cb, Problem theProblem, java.util.Map<String, String> __ctx, boolean __explicitCtx)
    {
        if(__explicitCtx &&  __ctx == null)
        {
            __ctx = _emptyContext;
        }
        __cb.__invoke(this, __cb, theProblem, __ctx);
    }

    public String
    submitProblem(String problemName, Parameter[] inParams)
        throws TooManyJobsException
    {
        return submitProblem(problemName, inParams, null, false);
    }

    public String
    submitProblem(String problemName, Parameter[] inParams, java.util.Map<String, String> __ctx)
        throws TooManyJobsException
    {
        return submitProblem(problemName, inParams, __ctx, true);
    }

    @SuppressWarnings("unchecked")
    private String
    submitProblem(String problemName, Parameter[] inParams, java.util.Map<String, String> __ctx, boolean __explicitCtx)
        throws TooManyJobsException
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        int __cnt = 0;
        while(true)
        {
            Ice._ObjectDel __delBase = null;
            try
            {
                __checkTwowayOnly("submitProblem");
                __delBase = __getDelegate();
                _ProcessorDel __del = (_ProcessorDel)__delBase;
                return __del.submitProblem(problemName, inParams, __ctx);
            }
            catch(IceInternal.LocalExceptionWrapper __ex)
            {
                __handleExceptionWrapper(__delBase, __ex);
            }
            catch(Ice.LocalException __ex)
            {
                __cnt = __handleException(__delBase, __ex, __cnt);
            }
        }
    }

    public static ProcessorPrx
    checkedCast(Ice.ObjectPrx __obj)
    {
        ProcessorPrx __d = null;
        if(__obj != null)
        {
            try
            {
                __d = (ProcessorPrx)__obj;
            }
            catch(ClassCastException ex)
            {
                if(__obj.ice_isA("::JobProcessor::Processor"))
                {
                    ProcessorPrxHelper __h = new ProcessorPrxHelper();
                    __h.__copyFrom(__obj);
                    __d = __h;
                }
            }
        }
        return __d;
    }

    public static ProcessorPrx
    checkedCast(Ice.ObjectPrx __obj, java.util.Map<String, String> __ctx)
    {
        ProcessorPrx __d = null;
        if(__obj != null)
        {
            try
            {
                __d = (ProcessorPrx)__obj;
            }
            catch(ClassCastException ex)
            {
                if(__obj.ice_isA("::JobProcessor::Processor", __ctx))
                {
                    ProcessorPrxHelper __h = new ProcessorPrxHelper();
                    __h.__copyFrom(__obj);
                    __d = __h;
                }
            }
        }
        return __d;
    }

    public static ProcessorPrx
    checkedCast(Ice.ObjectPrx __obj, String __facet)
    {
        ProcessorPrx __d = null;
        if(__obj != null)
        {
            Ice.ObjectPrx __bb = __obj.ice_facet(__facet);
            try
            {
                if(__bb.ice_isA("::JobProcessor::Processor"))
                {
                    ProcessorPrxHelper __h = new ProcessorPrxHelper();
                    __h.__copyFrom(__bb);
                    __d = __h;
                }
            }
            catch(Ice.FacetNotExistException ex)
            {
            }
        }
        return __d;
    }

    public static ProcessorPrx
    checkedCast(Ice.ObjectPrx __obj, String __facet, java.util.Map<String, String> __ctx)
    {
        ProcessorPrx __d = null;
        if(__obj != null)
        {
            Ice.ObjectPrx __bb = __obj.ice_facet(__facet);
            try
            {
                if(__bb.ice_isA("::JobProcessor::Processor", __ctx))
                {
                    ProcessorPrxHelper __h = new ProcessorPrxHelper();
                    __h.__copyFrom(__bb);
                    __d = __h;
                }
            }
            catch(Ice.FacetNotExistException ex)
            {
            }
        }
        return __d;
    }

    public static ProcessorPrx
    uncheckedCast(Ice.ObjectPrx __obj)
    {
        ProcessorPrx __d = null;
        if(__obj != null)
        {
            ProcessorPrxHelper __h = new ProcessorPrxHelper();
            __h.__copyFrom(__obj);
            __d = __h;
        }
        return __d;
    }

    public static ProcessorPrx
    uncheckedCast(Ice.ObjectPrx __obj, String __facet)
    {
        ProcessorPrx __d = null;
        if(__obj != null)
        {
            Ice.ObjectPrx __bb = __obj.ice_facet(__facet);
            ProcessorPrxHelper __h = new ProcessorPrxHelper();
            __h.__copyFrom(__bb);
            __d = __h;
        }
        return __d;
    }

    protected Ice._ObjectDelM
    __createDelegateM()
    {
        return new _ProcessorDelM();
    }

    protected Ice._ObjectDelD
    __createDelegateD()
    {
        return new _ProcessorDelD();
    }

    public static void
    __write(IceInternal.BasicStream __os, ProcessorPrx v)
    {
        __os.writeProxy(v);
    }

    public static ProcessorPrx
    __read(IceInternal.BasicStream __is)
    {
        Ice.ObjectPrx proxy = __is.readProxy();
        if(proxy != null)
        {
            ProcessorPrxHelper result = new ProcessorPrxHelper();
            result.__copyFrom(proxy);
            return result;
        }
        return null;
    }
}
